package com.ruoyi.system.service;
import java.util.List;
import java.util.Map;

import com.ruoyi.system.domain.HatchetMerchant;
import com.ruoyi.system.vo.AgentMerchantChangeVo;
/**
 * 商户列 服务层
 * 
 * @author ruoyi
 * @date 2019-02-18
 */
public interface IHatchetMerchantService 
{
	/**
     * 查询商户列信息
     * 
     * @param iD 商户列ID
     * @return 商户列信息
     */
	public HatchetMerchant selectHatchetMerchantById(String iD);
	
	/**
	 * 通过商户编号查询商户信息
	 * @param merchantNo 商户编号
	 * @return
	 */
	HatchetMerchant selectHatchetMerchantByMerchantNo(String merchantNo);
	
	/**
     * 查询商户列列表
     * 
     * @param hatchetMerchant 商户列信息
     * @return 商户列集合
     */
	public List<HatchetMerchant> selectHatchetMerchantList(HatchetMerchant hatchetMerchant);
	
	/**
     * 新增商户列
     * 
     * @param hatchetMerchant 商户列信息
     * @return 结果
     */
	public int insertHatchetMerchant(HatchetMerchant hatchetMerchant);
	
	/**
     * 修改商户列
     * 
     * @param hatchetMerchant 商户列信息
     * @return 结果
     */
	public int updateHatchetMerchant(HatchetMerchant hatchetMerchant);
		
	/**
     * 删除商户列信息
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
	public int deleteHatchetMerchantByIds(String ids);

	public HatchetMerchant selectHatchetMerchantByNo(String merchantNo);

	/**
	 * 代理商查询所有商户
	 * @param hatchetMerchant
	 * @return
	 */
	public List<HatchetMerchant> selectHatchetMerchantForDLS(HatchetMerchant hatchetMerchant);

	public HatchetMerchant getMerchantByPhoneOrLinkPhone(String  phone);
	
	/**
	 * 代理商查询下属商户数量
	 * @param departmentCode
	 * @return
	 */
	public Long selectHatchetMerchantCountForDLS(HatchetMerchant hatchetMerchant);
	
	/**
	 * 代理商查询下属激活商户数量
	 * @param departmentCode
	 * @return
	 */
	public Long selectActivHatchetMerchantCountForDLS(HatchetMerchant hatchetMerchant);

	public HatchetMerchant getMerchantByPhoneOrLinkPhone(String phone, String string);
	/**
	 * 代理商查询下属商户 返回商户财务列表
	 * @param hatchetMerchant
	 * @return
	 */
	public List<AgentMerchantChangeVo> selectUnderMoneyForDLS(HatchetMerchant hatchetMerchant);

	/**
	 * 代理商把客户升级为经纪人的操作
	 * @param hatchetMerchant
	 * @param codeCount 
	 * @return
	 * @throws Exception
	 */
	public Map<String, Object> doLiftMerchant(HatchetMerchant hatchetMerchant, Integer codeCount) throws Exception;

	/**
	 * 从配置表获取升级经纪人所需的升级码数量
	 * @return
	 */
	public Integer getUpgradeCodeCountForJJR();
	
	/**
	 * 每月一号定时清理经纪人月贡献
	 */
	public void cleanMerMonMoney(String defaultVule);
	/**
	 * 创建无卡订单
	 * 
	 * @param merchant
	 * @param trade_amount
	 * @param saletype
	 * @param info
	 * @return
	 * @throws CardBinNotFoundException
	 */
	/*public HatchetOrderPayment createNocardOrder(HatchetMerchant merchant, String trade_amount, String saletype,
			Map<String, Object> info, BigDecimal rate, BigDecimal procedureFee, int isground)
			throws CardBinNotFoundException;*/
	
	/**
	 * 给经纪人按照收益排序
	 * @param hatchetMerchant
	 * @return
	 */
	public List<HatchetMerchant> sortJJR(HatchetMerchant hatchetMerchant);
	
	/**
	 * 修改用户
	 * @param hatchetMerchant
	 * @return
	 */
	public Map<String, Object> editSave(HatchetMerchant hatchetMerchant);
	
	/**
	 * 查询经理人信息
	 * @param hatchetMerchant
	 * @return
	 */
	public List<HatchetMerchant> selectJLR(HatchetMerchant hatchetMerchant);
	
	/**
	 * 经理人审核通过
	 * @param order
	 * @return
	 */
	public Map<String, Object> checkSuccess(HatchetMerchant hatchetMerchant,String createBy);
	
	/**
	 * 经理人审核不通过
	 * @param orderId
	 * @return
	 */
	public Map<String, Object> checkFail(HatchetMerchant hatchetMerchant,String createBy);
	
	/**
	 * 高级经纪人查询托管卡用户列表
	 * @param hatchetMerchant
	 * @return
	 */
	public List<HatchetMerchant> selectHatchetMerchantForJLR(HatchetMerchant hatchetMerchant);
	
	/**
	 * 递归查询用户
	 * @param merchantList 用户列表
	 * @param parentPhone 当前用户手机号
	 * @return
	 */
	public List<HatchetMerchant> getMerchantTree(List<HatchetMerchant> merchantList ,String parentPhone);
	
	/**
	 * 通过手机号查询
	 * @param phone
	 * @return
	 */
	HatchetMerchant selectHatchetMerchantByPhone(String phone);
	
	/**
	 * 查询用户的上级推荐用户 （只在同一个代理商下面）
	 * @param merchantList 用户列表
	 * @param parentPhone 当前用户手机号
	 * @return
	 */
	List<HatchetMerchant> getMerchantParentTree(String phone);
	
	/**
	 * H5用户注册
	 * @param merchant
	 * @return
	 */
	public Map<String, Object> h5Register(HatchetMerchant merchant);

	public List<HatchetMerchant> selectAllMerchant();
	
}
